from django import forms
from django.forms import widgets

from pms import models


class SettingsThresholdAdminForm(forms.ModelForm):

    def __init__(self, *args, **kwargs):
        super(SettingsThresholdAdminForm, self).__init__(*args, **kwargs)
        if 'initial' in kwargs:
            # self.fields['quota'].queryset = models.SettingsDataQuota.objects.filter(target_type_id=1)
            self.tid = kwargs.get('initial').get('tid')
            print('------------tid: {}'.format(self.tid))

    class Meta:
        model = models.SettingsThreshold
        fields = '__all__'
